package com.itheima.util;

import com.itheima.pojo.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
    // 修改 GloableExceptionHandler.java
    @RestControllerAdvice
    public class GloableExceptionHandler {

        //处理TliasException异常
        @ExceptionHandler(TliasException.class)
        public Result handleTliasException(TliasException e){
            e.printStackTrace();
            //返回错误信息
            return Result.error(e.getMessage());
        }

        //处理其他异常
        @ExceptionHandler
        public Result ex(Exception e){
            e.printStackTrace();
            return Result.error("对不起,操作失败,请联系管理员");
        }
    }
